package com.bao.work;

import java.io.*;
import java.util.Date;

/**
 * @author baoye
 * @date 2024-08-06/18:39
 */
public class Work03 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis=new FileInputStream("D:\\course\\02-JavaSE进阶\\day11-IO流\\day10-IO流\\录屏\\106-转换流和文件字符流的关系.avi");
        FileOutputStream fos=new FileOutputStream("D:\\course\\02-JavaSE进阶\\day11-IO流\\day10-IO流\\录屏\\copy.avi");

        byte[] car=new byte[1024];
        int len;
        Long startTime=new Date().getTime();
        while((len=fis.read(car))!=-1){
            fos.write(car,0,len);
            fos.flush();
        }
        Long endTime=new Date().getTime();
        System.out.println("节点流耗时"+(endTime-startTime));

        fos.close();
        fis.close();

        BufferedInputStream bis=new BufferedInputStream(new FileInputStream("D:\\course\\02-JavaSE进阶\\day11-IO流\\day10-IO流\\录屏\\106-转换流和文件字符流的关系.avi"));
        BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream("D:\\course\\02-JavaSE进阶\\day11-IO流\\day10-IO流\\录屏\\copy2.avi"));
        byte[] car2=new byte[1024];
        int len2;
        Long startTime2=new Date().getTime();
        while((len=bis.read(car2))!=-1){
            bos.write(car,0,len);
            bos.flush();
        }
        Long endTime2=new Date().getTime();
        System.out.println("节点流耗时"+(endTime2-startTime2));

        bos.close();
        bis.close();
    }
}
